233. 不同區域 GCE與GKE LB連線

Why

突然來了個要求,要從美東的GCE 連到臺灣的GKE。
GKE的機器,我建了內部 LB 。
但只有同一個區域的GCE機器能夠連。
連去GCE 直接ping各個區域的機器,都正常。
但連GKE的LB 就不通。

Solution

諮詢了顧問公司,
他們的回答是VPC內部的子網路都是互通的(沒錯,測試有通),
但要連到GKE的internal LB,
LB要開啓 Global access

233-fig.1.png

ref. 客戶端訪問

Troubleshoot

這幾天發現個問題,
手動更改Global access後,會自動變成Disable。
通報給Google了,後續看狀況。
但有建議說直接在server上面加 annotations

apiVersion: v1
kind: Service
metadata:
  annotations:
    # add globle access
    networking.gke.io/internal-load-balancer-allow-global-access: "true"
    networking.gke.io/load-balancer-type: "Internal"
  name: srs-source-internal
  namespace: srs-prod  
spec:
  type: LoadBalancer
  selector:
    app: srs-source
  ports:
    - protocol: TCP
      port: 1935
      targetPort: 1935
      name: rtmp

ref. Global access